<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Http\Controllers\SelectController;

/* Route::get('/', function () {
    // return view('welcome');
    return view('index');
}); */
// 选择场景
Route::get('/','SelectController@select');
Route::get('/select', 'SelectController@select');
Route::post('/select-status','SelectController@requestStatus');
Route::post('/select-view','SelectController@requestView');
// 懒加载测试
Route::get('/lan','SelectController@lan');
Route::post('appuser/user/create', 'AppController@create');
Route::post('appuser/msg/push', 'AppController@pushMsg');
Route::get('appuser/device/offline/{sid}', 'AppController@offline');
// 不需要进行csrf验证
Route::group(['prefix' => 'appuser','middleware' => ['appuser']], function () {
  Route::post('user/update', ['as' => 'appuser.update', 'uses' => 'AppController@update']);
  Route::post('device/create', ['as' => 'appuser.device.create', 'uses' => 'AppController@createDevice']);
// 修改devices表
  Route::post('device/update', ['as' => 'appuser.device.update', 'uses' => 'AppController@updateDeviceByCode']);
  Route::get('file/list', ['as' => 'appuser.list', 'uses' => 'AppController@list']);
  Route::get('file/{id}/{file}', ['as' => 'appuser.getFile', 'uses' => 'AppController@getFile']);
  Route::post('file/{id}/{file}', ['as' => 'appuser.putFile', 'uses' => 'AppController@putFile']);
});

Route::group(['prefix' => 'qrcode'], function () {
  Route::get('generate/{did}', ['as' => 'qrcode.generate', 'uses' => 'QrcodeController@generate']);
  Route::get('redirect/{did}', ['as' => 'qrcode.redirect', 'uses' => 'QrcodeController@redirect']);
});
